package com.xeem.core.net
{
	import flash.events.Event;
	import flash.events.SecurityErrorEvent;
	import flash.events.IOErrorEvent;
	
	/**
	 * SocketsEvent
	 * @version 1.0
	 * @fp version 9+
	 * @example new SocketsEvent()
	 */
	public class SocketEvent extends Event
	{
		//事件值
		public static const SECURITY_ERROR:String = SecurityErrorEvent.SECURITY_ERROR;
		public static const IO_ERROR:String = IOErrorEvent.IO_ERROR;  
		public static const DECODE_ERROR:String = "decode_error";  
		public static const RECEIVED:String = "received";
		//public static const SENDING:String = "sending";
		public static const CLOSE:String = Event.CLOSE;
		public static const CONNECT:String = Event.CONNECT;
		//
		private var _data:*;
		
		public function SocketEvent(type:String, mydata:* = null, bubbles:Boolean = false, cancelable:Boolean = false) 
		{
			_data = mydata;
			super(type, bubbles, cancelable);
		}
		
		public function get data():*
		{ 
			return _data;
		}
		
		public function set data(value:*):void 
		{
			_data = value;
		}
		
		override public function clone():Event
		{
			return new SocketEvent(type, data, bubbles, cancelable);
		}
		
		override public function toString():String
		{
			return formatToString("SocketEvent", "type", "data", "bubbles", "cancelable", "eventPhase");
		}
	}
}